package com.tuzhi.base.web.vo;

import com.tuzhi.common.domain.ResultBO;

import java.util.HashMap;
import java.util.Map;

public class AjaxResultVO<E> extends ResultBO<E> {

    public AjaxResultVO() {
    }

    public AjaxResultVO(String code, String msg) {
        super(code, msg);
    }

    public AjaxResultVO(String code, String msg, E data) {
        super(code, msg, data);
    }

    public AjaxResultVO putData(String key, Object obj) {
        Object data = getData();
        Map<String, Object> map = new HashMap<>();
        if (data != null) {
            if (data instanceof Map) {
                map = (Map)data;
            }
        }
        map.put(key, obj);
        setData((E) map);
        return this;
    }

}
